package com.xinqi.modules.course.image.controller.inner;

import com.xinqi.common.base.response.PageInfo;
import com.xinqi.common.base.response.Param;
import com.xinqi.common.base.response.R;
import com.xinqi.modules.course.image.dto.req.CourseImageQueryDTO;
import com.xinqi.modules.course.image.dto.rsp.CourseImageResultDTO;
import com.xinqi.modules.course.image.service.CourseImageService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 课程背景封面图表内部控制层
 *
 * @author: system
 * @date: 2023/03/22
 */
@Hidden
@RestController
@RequestMapping("/inner/course-image")
@RequiredArgsConstructor
public class CourseImageInnerController {
    private final CourseImageService courseImageService;

    /**
     * 课程背景封面图表-分页
     */
    @GetMapping("/page")
    public R<PageInfo<CourseImageResultDTO>> page(Param pageable, CourseImageQueryDTO dto) {
        PageInfo<CourseImageResultDTO> page = courseImageService.page(pageable, dto);
        return R.data(page);
    }

    /**
     * 课程背景封面图表-详情
     */
    @GetMapping("/{id}")
    public R<CourseImageResultDTO> findById(@PathVariable("id") Long id) {
        CourseImageResultDTO dto = courseImageService.findById(id);
        return R.data(dto);
    }
}
